package nccloud.web.gl.voucher.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import nc.bs.voucher.itf.IVourcherSumService;
import nc.vo.pub.BusinessException;
import nccloud.dto.gl.lightgl.VoucherMDVO;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;
import nccloud.web.gl.tool.DisplayShowTool;

/**
 * 凭证汇总选择
 * @author Administrator
 * @date 2024年2月21日
 */
public class SumVoucherAction implements ICommonAction {
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public Object doAction(IRequest request) {
		String json = request.read();
		Map valMap = JsonFactory.create().fromJson(json, Map.class);

		try {
			IVourcherSumService service = ServiceLocator.find(IVourcherSumService.class);
			VoucherMDVO mdvo = service.showSumDetails((String) valMap.get("pk_voucher"), (List<String>)valMap.get("ids"),(List<String>)valMap.get("fzhss"));
			Map<String, Object> paraInfo = service.queryBookCombineInfos(mdvo.getPk_accountingbook(), mdvo.getPrepareddate().toStdString(), true);
			Map<String, Object> voucherMap = DisplayShowTool.voucherConvert("20021005card", mdvo, paraInfo);
			Map<String, Object> returnMap = new HashMap();
			returnMap.put("voucher", voucherMap);
			returnMap.put("paraInfo", paraInfo);
			return returnMap;
		} catch (BusinessException var8) {
			ExceptionUtils.wrapException(var8);
			return null;
		}
	}

}
